package java8;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/7/21 10:09
 */
public class TestDataTimeFormatter {
    public static void main(String[] args) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");

        Callable<LocalDate> call = () -> LocalDate.parse("20160304", formatter);


        ExecutorService pool = Executors.newFixedThreadPool(10);
        List<Future<LocalDate>> result = new ArrayList<>(10);
        for (int i = 0; i < 10; i++) {
            result.add(pool.submit(call));
        }

        for (Future<LocalDate> future : result) {
            try {
                System.out.println(future.get());
            } catch (InterruptedException | ExecutionException e) {
                e.printStackTrace();
            }
        }

        pool.shutdown();
    }
}
